#include <iostream>
using namespace std;

int main() {
    int list[5][5];
    int flag = 0;
    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 5; j++)
        {
            cin >> list[i][j];
        }
    }

    int rowMaxX = 0,rowMaxY = 0, colMinX = 0, colMinY = 0; // 每行最大数的坐标、每列最小数的坐标
    int rowMaxVal=0,colMinVal=0; // 每行最大数的值，每列最小数的值
    for (int i = 0; i < 5; i++)
    {
        rowMaxVal = list[i][0]; // 初始化每行最大值为：(i行,第一列)
        rowMaxX = i;
        rowMaxY = 0; 
        for (int j = 0; j < 5; j++)
        {
            if (list[i][j] > rowMaxVal)
            {
                rowMaxVal = list[i][j]; // 记录每行最大的值
                rowMaxX = i;
                rowMaxY = j; // 记录最大值的二维数组坐标
            }
        }
        colMinVal = list[0][rowMaxY]; // 初始化每列最小值：为(第一行,该行最大值所在的列)
        colMinX = 0;
        colMinY = rowMaxY;
        for (int k = 0; k < 5; k++)
        {
            if (list[k][rowMaxY] < colMinVal)
            {
                colMinVal = list[k][rowMaxY];
                colMinX = k;
                colMinY = rowMaxY;
            }
        }
        if (rowMaxX == colMinX && rowMaxY == colMinY)
        {
            cout << rowMaxX+1 << " " << rowMaxY+1 << " " << list[rowMaxX][rowMaxY] << endl;
            flag = 1;
        }
    }
    
    if (flag == 0)
    {
        cout << "not found";
    }
    
    return 0;
}